package com.aoxiang.earlywaringapi.controller;

import com.aoxiang.earlywaringapi.module.BaseHouseholdInfo;
import com.aoxiang.earlywaringapi.service.BaseHouseholdInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotEmpty;
import java.util.List;

/**
 * @author teevil@126.com
 * @date 2021/6/28
 */
@RestController
@RequestMapping("/info")
public class BaseHouseholdInfoController {
    private final BaseHouseholdInfoService baseHouseholdInfoService;

    public BaseHouseholdInfoController(BaseHouseholdInfoService baseHouseholdInfoService) {
        this.baseHouseholdInfoService = baseHouseholdInfoService;
    }

    @GetMapping("/list")
    public List<BaseHouseholdInfo> baseHouseholdInfoList(@NotEmpty @RequestParam String countryHouseHoldNo) {

        return this.baseHouseholdInfoService.getListByCountryHouseholdNo(countryHouseHoldNo);
    }
}
